Skip to content

fix: make ziglint self-lint clean#3

Merged
EugOT merged 2 commits into
mainfrom
codex/lint-clean
Jun 12, 2026
Merged

fix: make ziglint self-lint clean#3
EugOT merged 2 commits into
mainfrom
codex/lint-clean

Conversation

@EugOT

@EugOT EugOT commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • make ziglint's own lint smoke expect a clean exit again
  • update current Zig 0.16 std.mem APIs and type-constructor fixtures
  • align allocator/io argument ordering and recognize Zig 0.16 type-constructor builtins as type aliases

Validation

  • zig fmt --check src/*.zig build.zig build.zig.zon
  • find src -name '*.zig' -exec zig ast-check {} \;
  • zig ast-check build.zig
  • zig build test --summary failures --test-timeout 60s --global-cache-dir .zig-global-cache
  • zig build lint --summary failures --global-cache-dir .zig-global-cache
  • zig build -Dtarget=x86_64-linux --summary failures --global-cache-dir .zig-global-cache

Copilot AI review requested due to automatic review settings June 12, 2026 14:29
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@EugOT, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 9 minutes and 12 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5f156fb0-8c89-4288-83ab-e27d887b99aa

📥 Commits

Reviewing files that changed from the base of the PR and between e561228 and dff899d.

📒 Files selected for processing (9)
  • .gitignore
  • build.zig
  • src/Config.zig
  • src/Linter.zig
  • src/ModuleGraph.zig
  • src/TypeResolver.zig
  • src/doc_tests.zig
  • src/main.zig
  • src/rules.zig
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/lint-clean

Comment @coderabbitai help to get the list of available commands and usage tips.

@EugOT

EugOT commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates ziglint’s internals and fixtures for Zig 0.16 API changes and restores the project’s “self-lint smoke” step to expect a clean (exit code 0) run, ensuring ziglint can lint its own source without findings.

Changes:

  • Update Zig stdlib string search calls from std.mem.indexOf*/indexOfPos to Zig 0.16 std.mem.find*/findPos.
  • Standardize allocator/I/O parameter ordering (notably ModuleGraph.init and Config.load) and update call sites/tests accordingly.
  • Expand recognition of Zig 0.16 builtin type-constructor builtins for type-expression/type-alias detection in the linter, updating related tests and enabling self-lint to require exit code 0.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/TypeResolver.zig Updates number-literal parsing to Zig 0.16 std.mem.find APIs; updates ModuleGraph.init call ordering in tests.
src/rules.zig Switches rule message context parsing to std.mem.findScalar for Zig 0.16.
src/ModuleGraph.zig Reorders init parameters to (allocator, io, ...) and updates tests accordingly.
src/main.zig Aligns argument ordering (detectColorSupport, FileConfig.load, loadGitignore, ModuleGraph.init) and updates string searches to find/findPos.
src/Linter.zig Adds builtin type-constructor recognition helper, uses it for type-expression/alias checks, and updates related fixtures/tests to Zig 0.16-style constructors.
src/doc_tests.zig Updates markdown parsing searches to find/findPos and adjusts ModuleGraph.init call ordering.
src/Config.zig Reorders load/config-discovery function parameters to (allocator, io, ...) and updates internal call sites.
build.zig Restores self-lint smoke to expect exit code 0, keeping it in the test aggregate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kilo-code-bot

kilo-code-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

Code Review Roast 🔥

Verdict: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
🚨 critical 2
⚠️ warning 0
💡 suggestion 0
🤏 nitpick 0
Issue Details (click to expand)
File Line Roast
src/Linter.zig 1099 @EnumLiteral in type constructor list - not a Zig builtin
src/Linter.zig 1105 @tuple in type constructor list - not a Zig builtin

🏆 Best part: The Zig 0.16 migration is thorough - all those indexOffind renames hit every call site. Someone actually ran the tests.

💀 Worst part: The isBuiltinTypeConstructor function includes @EnumLiteral and @Tuple which are NOT callable Zig builtins. These are type tags (std.builtin.Type.enum_literal, std.builtin.Type.tuple) not constructors.

📊 Overall: Like a buffet that looks great but contains rat poison - the migration is solid but two poison pills snuck in.

Files Reviewed (8 files)
  • build.zig - 0 issues
  • src/Config.zig - 0 issues
  • src/Linter.zig - 2 issues
  • src/ModuleGraph.zig - 0 issues
  • src/TypeResolver.zig - 0 issues
  • src/doc_tests.zig - 0 issues
  • src/main.zig - 0 issues
  • src/rules.zig - 0 issues

Reviewed by nex-n2-pro:free · 175,942 tokens

Comment thread src/Linter.zig
Comment thread src/Linter.zig
WHY: Two Kilo review nits questioned whether @EnumLiteral (Linter.zig:1099)
and @tuple (Linter.zig:1105) belong in the builtin type-constructor list.
Verified against the Zig 0.16 langref shipped with the compiler: both are
documented type-constructor builtins returning `type`
(§@EnumLiteral -> '@EnumLiteral() type', §@tuple ->
'@tuple(comptime field_types: []const type) type'), confirmed in the builtin
TOC and resolved by the live 0.16 compiler. The nits are false positives;
removing the entries would regress isTypeExpression for those aliases.

WHAT:
- Add an in-code rationale comment next to @EnumLiteral/@tuple documenting
  their langref provenance so the entries are not re-flagged.
- Ignore .zig-global-cache/ (project-local global cache dir) in .gitignore.

IMPACT: src/Linter.zig (isBuiltinTypeConstructor comment only; no behavior
change), .gitignore. Self-lint gate stays clean.

VALIDATION: mise x zig@0.16.0 -- zig build test --summary all -> 7/7 steps,
274/274 tests pass, including zig fmt and the lint_smoke self-lint gate at
expectExitCode(0). Self-lint on 'src build.zig' emits zero findings, exit 0.
@EugOT EugOT merged commit 5688de1 into main Jun 12, 2026
7 checks passed
@EugOT EugOT deleted the codex/lint-clean branch June 12, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants